<?php

//管理员
namespace app\common\model;


use think\Db;
use think\Model;

class Admin extends Model
{
    public function adminRole(){
        return $this->hasManyThrough('AdminRole','AdminRoleRelated');
    }

    /**
     * 获取超级管理员的id集合
     * @param string $admin_id 需要添加到数组的管理员id
     * @return array
     */
    public static function getSuperAdminId($admin_id=''){
        $data = Db::name('AdminRoleRelated')->where('admin_role_id',1)->column('admin_id');
        if (!empty($admin_id)){
            $data[] = $admin_id;
        }
        return $data;
    }
}
